<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateStatPayLogTable extends Migration
{
    protected $connection = 'stat';

    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('stat_pay_log', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('stat_ts')->default(0)->comment('统计时间戳');
            $table->integer('pay_order_num')->default(0)->comment('充值订单数');
            $table->integer('pay_rmb_num')->default(0)->comment('充值总金额');
            $table->integer('wechat_order_num')->default(0)->comment('微信订单数');
            $table->integer('wechat_rmb_num')->default(0)->comment('微信充值金额');
            $table->integer('alipay_order_num')->default(0)->comment('支付宝订单数');
            $table->integer('alipay_rmb_num')->default(0)->comment('支付宝充值金额');
            $table->timestamps();
            $table->tinyInteger('flag')->default(1)->comment('记录状态');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('stat_pay_log');
    }
}
